package com.zhoug.map2.dianditu;

import android.text.TextUtils;

import com.zhoug.logger2.Logger;

import androidx.annotation.Keep;

/**
 * @Author: zhoug
 * @Date: 2025-01-03
 * @Description:
 */
@Keep
public class Poi {
    private String name;//Poi点名称 "华光商厦",
    private String address;//地址 "阜成路61号",
    private String ename;//poi点英文名称 "Huaguang Shopping Center",
    private String eaddress;//英文地址 "",
    private String phone;//电话 "",
    private String province;//所属省名称 "北京市",
    private String provinceCode;//省行政区编码 "156110000",
    private String city;//所属城市名称 "",
    private String cityCode;//市行政区编码 "",
    private String county;//所属区县名称 "海淀区",
    private String countyCode;//区县行政区编码 "156110108",
    private String lonlat;//坐标 "116.295768,39.923046",
    private String typeName;//分类名称 "大厦",
    private String typeCode;//分类编码 "200103",
    private String source;//数据信息来源 "0",
    private String poiType;//poi类型 101:POI数据 102:公交站点
    private String hotPointID;//poi热点ID "C14E650274DF9803"
    //以下是自定义字段
    private double latitude;
    private double longitude;
    private boolean latlongInit = false;

    public String getEaddress() {
        return eaddress;
    }

    public void setEaddress(String eaddress) {
        this.eaddress = eaddress;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getProvinceCode() {
        return provinceCode;
    }

    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }

    public String getCityCode() {
        return cityCode;
    }

    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }

    public String getCounty() {
        return county;
    }

    public void setCounty(String county) {
        this.county = county;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getTypeCode() {
        return typeCode;
    }

    public void setTypeCode(String typeCode) {
        this.typeCode = typeCode;
    }

    public String getLonlat() {
        return lonlat;
    }

    public void setLonlat(String lonlat) {
        this.lonlat = lonlat;
    }

    public String getCountyCode() {
        return countyCode;
    }

    public void setCountyCode(String countyCode) {
        this.countyCode = countyCode;
    }

    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPoiType() {
        return poiType;
    }

    public void setPoiType(String poiType) {
        this.poiType = poiType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHotPointID() {
        return hotPointID;
    }

    public void setHotPointID(String hotPointID) {
        this.hotPointID = hotPointID;
    }

    public double getLatitude() {
        initLatlong();
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public double getLongitude() {
        initLatlong();
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    private void initLatlong() {
        if (!latlongInit) {
            latlongInit = true;
            // "116.295768,39.923046",
            if (!TextUtils.isEmpty(lonlat) && lonlat.contains(",")) {
                String[] split = lonlat.split(",");
                try {
                    longitude= Double.parseDouble(split[0]);
                    latitude=Double.parseDouble(split[1]);
                } catch (NumberFormatException e) {
                    Logger.e(">>>", "initLatlong:"+e.getMessage());
                }
            }
        }
    }
}
